package fr.esiag.isidis.epp.service;
import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import fr.esiag.isidis.epp.model.TemperatureModel;
import fr.esiag.isidis.epp.repository.TemperatureRepository;

@Service
public class TemperatureService {

		private static Logger logger = Logger.getLogger(TemperatureService.class);

		@Autowired
		private TemperatureRepository temperatureRepository;

		public void loadCsvFile() throws Exception
		{
			List<TemperatureModel> items = temperatureRepository.temperature_extractFromCsvFile();

			for(TemperatureModel item : items)
			{
				temperatureRepository.loadTemperature(item);
				logger.debug("Insertion de l'item temperature " + item);
			}
		}

	}
